<?php class Races { 

    /***
     * DB Fields: id
     *
     *
     * THIS IS a generated method using the DBClassGenerator 
     * created by John paul de Guzman <jpdguzman@gmail.com> 
     *
     **/
    var $id;

    /***
     * DB Fields: name
     *
     *
     * THIS IS a generated method using the DBClassGenerator 
     * created by John paul de Guzman <jpdguzman@gmail.com> 
     *
     **/
    var $name;

    /***
     * DB Fields: description
     *
     *
     * THIS IS a generated method using the DBClassGenerator 
     * created by John paul de Guzman <jpdguzman@gmail.com> 
     *
     **/
    var $description;

    /***
     * DB Fields: expRatioMining
     *
     *
     * THIS IS a generated method using the DBClassGenerator 
     * created by John paul de Guzman <jpdguzman@gmail.com> 
     *
     **/
    var $expRatioMining;

    /***
     * DB Fields: expRatioBuilding
     *
     *
     * THIS IS a generated method using the DBClassGenerator 
     * created by John paul de Guzman <jpdguzman@gmail.com> 
     *
     **/
    var $expRatioBuilding;

    /***
     * DB Fields: expRatioResearch
     *
     *
     * THIS IS a generated method using the DBClassGenerator 
     * created by John paul de Guzman <jpdguzman@gmail.com> 
     *
     **/
    var $expRatioResearch;

    /***
     * DB Fields: expRatioBattle
     *
     *
     * THIS IS a generated method using the DBClassGenerator 
     * created by John paul de Guzman <jpdguzman@gmail.com> 
     *
     **/
    var $expRatioBattle;

    /***
     * DB Fields: expRatioTrading
     *
     *
     * THIS IS a generated method using the DBClassGenerator 
     * created by John paul de Guzman <jpdguzman@gmail.com> 
     *
     **/
    var $expRatioTrading;

    /***
     * DB Fields: expLevelRatio
     *
     *
     * THIS IS a generated method using the DBClassGenerator 
     * created by John paul de Guzman <jpdguzman@gmail.com> 
     *
     **/
    var $expLevelRatio;

    /***
     * DB Fields: bonusToBuilding
     *
     *
     * THIS IS a generated method using the DBClassGenerator 
     * created by John paul de Guzman <jpdguzman@gmail.com> 
     *
     **/
    var $bonusToBuilding;

    /***
     * DB Fields: bonusToResearch
     *
     *
     * THIS IS a generated method using the DBClassGenerator 
     * created by John paul de Guzman <jpdguzman@gmail.com> 
     *
     **/
    var $bonusToResearch;

//--------------- GET METHODS ----------------------------- //
    /***
     * Get value for field: id
     *
     *
     * THIS IS a generated method using the DBClassGenerator 
     * created by John paul de Guzman <jpdguzman@gmail.com> 
     *
     * @result id
     **/
    function get_id( ) {
        // returns the value of id
        return $this->id;
    }


    /***
     * Get value for field: name
     *
     *
     * THIS IS a generated method using the DBClassGenerator 
     * created by John paul de Guzman <jpdguzman@gmail.com> 
     *
     * @result name
     **/
    function get_name( ) {
        // returns the value of name
        return $this->name;
    }


    /***
     * Get value for field: description
     *
     *
     * THIS IS a generated method using the DBClassGenerator 
     * created by John paul de Guzman <jpdguzman@gmail.com> 
     *
     * @result description
     **/
    function get_description( ) {
        // returns the value of description
        return $this->description;
    }


    /***
     * Get value for field: expRatioMining
     *
     *
     * THIS IS a generated method using the DBClassGenerator 
     * created by John paul de Guzman <jpdguzman@gmail.com> 
     *
     * @result expRatioMining
     **/
    function get_expRatioMining( ) {
        // returns the value of expRatioMining
        return $this->expRatioMining;
    }


    /***
     * Get value for field: expRatioBuilding
     *
     *
     * THIS IS a generated method using the DBClassGenerator 
     * created by John paul de Guzman <jpdguzman@gmail.com> 
     *
     * @result expRatioBuilding
     **/
    function get_expRatioBuilding( ) {
        // returns the value of expRatioBuilding
        return $this->expRatioBuilding;
    }


    /***
     * Get value for field: expRatioResearch
     *
     *
     * THIS IS a generated method using the DBClassGenerator 
     * created by John paul de Guzman <jpdguzman@gmail.com> 
     *
     * @result expRatioResearch
     **/
    function get_expRatioResearch( ) {
        // returns the value of expRatioResearch
        return $this->expRatioResearch;
    }


    /***
     * Get value for field: expRatioBattle
     *
     *
     * THIS IS a generated method using the DBClassGenerator 
     * created by John paul de Guzman <jpdguzman@gmail.com> 
     *
     * @result expRatioBattle
     **/
    function get_expRatioBattle( ) {
        // returns the value of expRatioBattle
        return $this->expRatioBattle;
    }


    /***
     * Get value for field: expRatioTrading
     *
     *
     * THIS IS a generated method using the DBClassGenerator 
     * created by John paul de Guzman <jpdguzman@gmail.com> 
     *
     * @result expRatioTrading
     **/
    function get_expRatioTrading( ) {
        // returns the value of expRatioTrading
        return $this->expRatioTrading;
    }


    /***
     * Get value for field: expLevelRatio
     *
     *
     * THIS IS a generated method using the DBClassGenerator 
     * created by John paul de Guzman <jpdguzman@gmail.com> 
     *
     * @result expLevelRatio
     **/
    function get_expLevelRatio( ) {
        // returns the value of expLevelRatio
        return $this->expLevelRatio;
    }


    /***
     * Get value for field: bonusToBuilding
     *
     *
     * THIS IS a generated method using the DBClassGenerator 
     * created by John paul de Guzman <jpdguzman@gmail.com> 
     *
     * @result bonusToBuilding
     **/
    function get_bonusToBuilding( ) {
        // returns the value of bonusToBuilding
        return $this->bonusToBuilding;
    }


    /***
     * Get value for field: bonusToResearch
     *
     *
     * THIS IS a generated method using the DBClassGenerator 
     * created by John paul de Guzman <jpdguzman@gmail.com> 
     *
     * @result bonusToResearch
     **/
    function get_bonusToResearch( ) {
        // returns the value of bonusToResearch
        return $this->bonusToResearch;
    }


//--------------- SET METHODS ----------------------------- //
    /***
     * Set value for field: id
     *
     *
     * THIS IS a generated method using the DBClassGenerator 
     * created by John paul de Guzman <jpdguzman@gmail.com> 
     *
     * @param id
     * @result void
     **/
    function set_id( $id ) {
        // sets the value of id
        $this->id = $id;
    }

    /***
     * Set value for field: name
     *
     *
     * THIS IS a generated method using the DBClassGenerator 
     * created by John paul de Guzman <jpdguzman@gmail.com> 
     *
     * @param name
     * @result void
     **/
    function set_name( $name ) {
        // sets the value of name
        $this->name = $name;
    }

    /***
     * Set value for field: description
     *
     *
     * THIS IS a generated method using the DBClassGenerator 
     * created by John paul de Guzman <jpdguzman@gmail.com> 
     *
     * @param description
     * @result void
     **/
    function set_description( $description ) {
        // sets the value of description
        $this->description = $description;
    }

    /***
     * Set value for field: expRatioMining
     *
     *
     * THIS IS a generated method using the DBClassGenerator 
     * created by John paul de Guzman <jpdguzman@gmail.com> 
     *
     * @param expRatioMining
     * @result void
     **/
    function set_expRatioMining( $expRatioMining ) {
        // sets the value of expRatioMining
        $this->expRatioMining = $expRatioMining;
    }

    /***
     * Set value for field: expRatioBuilding
     *
     *
     * THIS IS a generated method using the DBClassGenerator 
     * created by John paul de Guzman <jpdguzman@gmail.com> 
     *
     * @param expRatioBuilding
     * @result void
     **/
    function set_expRatioBuilding( $expRatioBuilding ) {
        // sets the value of expRatioBuilding
        $this->expRatioBuilding = $expRatioBuilding;
    }

    /***
     * Set value for field: expRatioResearch
     *
     *
     * THIS IS a generated method using the DBClassGenerator 
     * created by John paul de Guzman <jpdguzman@gmail.com> 
     *
     * @param expRatioResearch
     * @result void
     **/
    function set_expRatioResearch( $expRatioResearch ) {
        // sets the value of expRatioResearch
        $this->expRatioResearch = $expRatioResearch;
    }

    /***
     * Set value for field: expRatioBattle
     *
     *
     * THIS IS a generated method using the DBClassGenerator 
     * created by John paul de Guzman <jpdguzman@gmail.com> 
     *
     * @param expRatioBattle
     * @result void
     **/
    function set_expRatioBattle( $expRatioBattle ) {
        // sets the value of expRatioBattle
        $this->expRatioBattle = $expRatioBattle;
    }

    /***
     * Set value for field: expRatioTrading
     *
     *
     * THIS IS a generated method using the DBClassGenerator 
     * created by John paul de Guzman <jpdguzman@gmail.com> 
     *
     * @param expRatioTrading
     * @result void
     **/
    function set_expRatioTrading( $expRatioTrading ) {
        // sets the value of expRatioTrading
        $this->expRatioTrading = $expRatioTrading;
    }

    /***
     * Set value for field: expLevelRatio
     *
     *
     * THIS IS a generated method using the DBClassGenerator 
     * created by John paul de Guzman <jpdguzman@gmail.com> 
     *
     * @param expLevelRatio
     * @result void
     **/
    function set_expLevelRatio( $expLevelRatio ) {
        // sets the value of expLevelRatio
        $this->expLevelRatio = $expLevelRatio;
    }

    /***
     * Set value for field: bonusToBuilding
     *
     *
     * THIS IS a generated method using the DBClassGenerator 
     * created by John paul de Guzman <jpdguzman@gmail.com> 
     *
     * @param bonusToBuilding
     * @result void
     **/
    function set_bonusToBuilding( $bonusToBuilding ) {
        // sets the value of bonusToBuilding
        $this->bonusToBuilding = $bonusToBuilding;
    }

    /***
     * Set value for field: bonusToResearch
     *
     *
     * THIS IS a generated method using the DBClassGenerator 
     * created by John paul de Guzman <jpdguzman@gmail.com> 
     *
     * @param bonusToResearch
     * @result void
     **/
    function set_bonusToResearch( $bonusToResearch ) {
        // sets the value of bonusToResearch
        $this->bonusToResearch = $bonusToResearch;
    }

//--------------- CRUD METHODS ----------------------------- //
    /***
     * Create a new Record: races
     *
     *
     * THIS IS a generated method using the DBClassGenerator 
     * created by John paul de Guzman <jpdguzman@gmail.com> 
     *
     * @param id
     * @param name
     * @param description
     * @param expRatioMining
     * @param expRatioBuilding
     * @param expRatioResearch
     * @param expRatioBattle
     * @param expRatioTrading
     * @param expLevelRatio
     * @param bonusToBuilding
     * @param bonusToResearch
     * @result void
     **/
    function createnew_races( $id, $name, $description, $expRatioMining, $expRatioBuilding, $expRatioResearch, $expRatioBattle, $expRatioTrading, $expLevelRatio, $bonusToBuilding, $bonusToResearch ) {

        // items to be inserted in the database 
        $_obj = array($id,
                      $name,
                      $description,
                      $expRatioMining,
                      $expRatioBuilding,
                      $expRatioResearch,
                      $expRatioBattle,
                      $expRatioTrading,
                      $expLevelRatio,
                      $bonusToBuilding,
                      $bonusToResearch); 

        // database object connection
        $dbConn = $GLOBALS['dbConn'];

        // perform insert in the database
        $dbConn->insert("races", $_obj);
    }

    /***
     * Retrived an existing record: races
     *
     *
     * THIS IS a generated method using the DBClassGenerator 
     * created by John paul de Guzman <jpdguzman@gmail.com> 
     *
     * @param id
     * @result new Races
     **/
    function get_races( $id ) {

        // retrive the data
        $dbConn = $GLOBALS['dbConn'];

        // retrieved value in the database
        $_resultSet = $dbConn->doQuery("SELECT * FROM races WHERE id = '$id'");

        $__racesObj = new races();
        // return the retrived from the database

        // create a new object
        $__obj = new Races();
        $__obj->set_id($_resultSet[0]['id']);
        $__obj->set_name($_resultSet[0]['name']);
        $__obj->set_description($_resultSet[0]['description']);
        $__obj->set_expRatioMining($_resultSet[0]['expRatioMining']);
        $__obj->set_expRatioBuilding($_resultSet[0]['expRatioBuilding']);
        $__obj->set_expRatioResearch($_resultSet[0]['expRatioResearch']);
        $__obj->set_expRatioBattle($_resultSet[0]['expRatioBattle']);
        $__obj->set_expRatioTrading($_resultSet[0]['expRatioTrading']);
        $__obj->set_expLevelRatio($_resultSet[0]['expLevelRatio']);
        $__obj->set_bonusToBuilding($_resultSet[0]['bonusToBuilding']);
        $__obj->set_bonusToResearch($_resultSet[0]['bonusToResearch']);


        return $__obj;
    }

    /***
     * Update an existing record: races
     *
     *
     * THIS IS a generated method using the DBClassGenerator 
     * created by John paul de Guzman <jpdguzman@gmail.com> 
     *
     * @param id
     * @param itemsToBeUpdated = array()
     * @result void
     **/
    function update_races( $id, $itemsToBeUpdated = array() ) {

         // get database connection
         $dbConn = $GLOBALS['dbConn'];

         // performs update in the database
         foreach($itemsToBeUpdated as $_fName => $_fVal) { 
               $dbConn->addValuePair($_fName, $_fVal);
         }

         // perform update operation
         $dbConn->update("races", "id = '$id'");
    }

    /***
     * Delete an existing record: races
     *
     *
     * THIS IS a generated method using the DBClassGenerator 
     * created by John paul de Guzman <jpdguzman@gmail.com> 
     *
     * @param id
     * @result void
     **/
    function delete_races( $id ) {

         // get database connection
         $dbConn = $GLOBALS['dbConn'];

         // performs deletion of data
         $dbConn->delete("races", "id = '$id'");
    }

    /***
     * Retrived list of objects base on a given parameters: races
     *
     *
     * THIS IS a generated method using the DBClassGenerator 
     * created by John paul de Guzman <jpdguzman@gmail.com> 
     *
     * @param conditionalStatement = ''
     * @result collection of objects: Races
     **/
    function list_races( $conditionalStatement = '' ) {

         $dbConn = $GLOBALS['dbConn'];
         // check if there is a given parameter list
         if(!empty($conditionalStatement)) { 
              $sqlStatement = "SELECT * FROM races WHERE $conditionalStatement"; 
         } else { 
              $sqlStatement = "SELECT * FROM races";
         }

         // retrieve the values base on the query result
         $__resObj = $dbConn->doQuery($sqlStatement);

         $__collectionOfObjects = array();
         foreach($__resObj as $__rs) { 
            $__newObj = new Races();

            $__newObj->set_id($__rs['id']);
            $__newObj->set_name($__rs['name']);
            $__newObj->set_description($__rs['description']);
            $__newObj->set_expRatioMining($__rs['expRatioMining']);
            $__newObj->set_expRatioBuilding($__rs['expRatioBuilding']);
            $__newObj->set_expRatioResearch($__rs['expRatioResearch']);
            $__newObj->set_expRatioBattle($__rs['expRatioBattle']);
            $__newObj->set_expRatioTrading($__rs['expRatioTrading']);
            $__newObj->set_expLevelRatio($__rs['expLevelRatio']);
            $__newObj->set_bonusToBuilding($__rs['bonusToBuilding']);
            $__newObj->set_bonusToResearch($__rs['bonusToResearch']);

            // add object to collection 
            array_push($__collectionOfObjects, $__newObj);
         }

         // return collection of objects
         return $__collectionOfObjects;
    }

} ?>